/*
 * @lc app=leetcode.cn id=168 lang=javascript
 *
 * [168] Excel表列名称
 */

// @lc code=start
/**
 * @param {number} columnNumber
 * @return {string}
 */
var convertToTitle = function (columnNumber) {
    if (columnNumber <= 0) return;
    let res = [];
    while (columnNumber) {
        columnNumber--;
        let remain = columnNumber % 26;
        res.unshift(String.fromCharCode(remain + 65));
        columnNumber = Math.floor(columnNumber / 26);
    }
    return res.join('')
};
// @lc code=end